$('[data-behavior="endless-scroll"]').append('<%= j render @dashboard.posts %>');

ReactRailsUJS.mountComponents();

<% if @dashboard.posts.next_page %>
  $('.pagination').replaceWith('<%= j will_paginate @dashboard.posts %>');
<% else %>
  $('.pagination').remove();
<% end %>
